package com.kinon.gfcanteen_v1.network;

import com.kinon.gfcanteen_v1.bean.BaseBean;
import com.kinon.gfcanteen_v1.bean.OrderDetailBean;
import com.kinon.gfcanteen_v1.bean.OrdersBean;
import com.kinon.gfcanteen_v1.bean.BalanceBean;
import com.kinon.gfcanteen_v1.bean.PayBean;

import io.reactivex.Flowable;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * Created by lhqq on 2018-01-09.
 */

public interface RequestApi {


    /**
     * 登录
     * @param username
     * @param password
     * @return
     */
    @FormUrlEncoded
    @POST("admin/login")
    Call<String>
    login(@Field("username") String username,
          @Field("password") String password);

    /**
     * 保存订单
     * @param token
     * @param total
     * @param type  10
     * @param stamp
     * @return
     */
    @FormUrlEncoded
    @POST("order/saveNewOrder_v2")
    Call<String>
    saveNewOrder(@Field("token") String token,
                 @Field("total") String total,
                 @Field("type") int type,
                 @Field("stamp") String stamp);

    /**
     * 结算支付
     * @param token
     * @param orderid
     * @param no
     * @param stamp
     * @return
     */
    @FormUrlEncoded
    @POST("order/otherPay")
    Call<String>
    otherPay(@Field("token") String token,
             @Field("orderid") String orderid,
             @Field("no") String no,
             @Field("stamp") String stamp);


    /**
     * 充值
     * @param token
     * @param no
     * @param money
     * @return
     */
    @FormUrlEncoded
    @POST("admin/recharge")
    Call<String>
    recharge(@Field("token") String token,
             @Field("no") String no,
             @Field("money") String money);

    /**
     * 获取订单列表
     * @param token
     * @param page
     * @param offset
     * @return
     */
    @FormUrlEncoded
    @POST("admin/getOrders")
    Call<String>
    getOrders(@Field("token") String token,
              @Field("page") int page,
              @Field("offset") int offset);


    /**
     * 订单详情
     * @param token
     * @param orderid
     * @param orderno
     * @return
     */
    @FormUrlEncoded
    @POST("order/getDetail")
    Call<String>
    getDetails(@Field("token") String token,
              @Field("orderid") String orderid,
              @Field("orderno") String orderno);


    /**
     * 确认收货
     * @param token
     * @param orderid
     * @param state 2
     * @return
     */
    @FormUrlEncoded
    @POST("order/updateOrder")
    Call<String>
    updateOrder(@Field("token") String token,
              @Field("orderid") int orderid,
              @Field("state") int state);


    /**
     * 余额查询
     * @param token
     * @param no
     * @param page
     * @param offset
     * @return
     */
    @FormUrlEncoded
    @POST("admin/getUserByCode")
    Call<String>
    getUserByCode(@Field("token") String token,
              @Field("no") String no,
              @Field("page") int page,
              @Field("offset") int offset);



}
